package org.eclipse.football;

import java.util.ArrayList;

public class DefPlayer {
	// Declare private member variables
	private String name;
	private int def_tds;
	private int picks;
	private int fumbles;
	private int sacks;
	private int blocks;
	private int safeties;
	private int pa;
	private int ya;
	
	// Define constructor
	public DefPlayer(String name){
		// Set name based off input
		this.name = name;
		
		// Initialize all other member variables to 0
		def_tds = 0;
		picks = 0;
		fumbles = 0;
		sacks = 0;
		blocks = 0;
		safeties = 0;
		pa = 0;
		ya = 0;
	}

	// Define function to calculate points for this player
	public int calculatePoints(){
		// Initialize sum to 0
		int sum = 0;
		
		// Add points for tds
		sum += 6*def_tds;
		
		// Add points for turnovers, sacks, safeties, and blocked kicks
		sum += 2*(picks+fumbles+sacks+blocks+safeties);
		
		// Add points for points allowed based off range
		if(pa == 0){
			sum += 5;
		}
		else if(pa <= 6){
			sum += 4;
		}
		else if(pa <= 13){
			sum += 3;
		}
		else if(pa <= 17){
			sum += 1;
		}
		else if(pa <= 27){
			// Add 0 pts
		}
		else if(pa <= 34){
			sum -= 1;
		}
		else if(pa <= 45){
			sum -= 3;
		}
		else{
			sum -= 5;
		}
		
		// Add points for yards allowed based off range
		if(ya < 100){
			sum += 5;
		}
		else if(ya < 200){
			sum += 3;
		}
		else if(ya < 300){
			sum += 2;
		}
		else if(ya < 350){
			// Add 0 pts
		}
		else if(ya < 400){
			sum -= 1;
		}
		else if(ya < 450){
			sum -= 3;
		}
		else if(ya < 500){
			sum -= 5;
		}
		else if(ya < 550){
			sum -= 6;
		}
		else{
			sum -= 7;
		}
		
		// Return sum
		return sum;
	}

	// Getters and setters
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getDef_tds() {
		return def_tds;
	}

	public void setDef_tds(int def_tds) {
		this.def_tds = def_tds;
	}

	public int getPicks() {
		return picks;
	}

	public void setPicks(int picks) {
		this.picks = picks;
	}

	public int getFumbles() {
		return fumbles;
	}

	public void setFumbles(int fumbles) {
		this.fumbles = fumbles;
	}

	public int getSacks() {
		return sacks;
	}

	public void setSacks(int sacks) {
		this.sacks = sacks;
	}

	public int getBlocks() {
		return blocks;
	}

	public void setBlocks(int blocks) {
		this.blocks = blocks;
	}

	public int getSafeties() {
		return safeties;
	}

	public void setSafeties(int safeties) {
		this.safeties = safeties;
	}

	public int getPa() {
		return pa;
	}

	public void setPa(int pa) {
		this.pa = pa;
	}

	public int getYa() {
		return ya;
	}

	public void setYa(int ya) {
		this.ya = ya;
	}
}
